<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" Codebehind="UserManager.aspx.cs"
    Inherits="ClickSocial.Admin.UserManager" Title="Untitled Page" %>

<%@ Register Src="controles/NewUser.ascx" TagName="NewUser" TagPrefix="uc1" %>

<%@ Register Src="controles/EditUser.ascx" TagName="EditUser" TagPrefix="uc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/Default.aspx" CssClass="volver">Volver</asp:HyperLink>
    <asp:LinkButton ID="lnkbtnCrearUsuario" runat="server" OnClick="lnkbtnCrearUsuario_Click" CssClass="CrearUsuario">Crear Usuario</asp:LinkButton>
    <h4>Usuarios</h4>
    <div style="text-align:right" >Filtrar Por:
        <asp:DropDownList ID="ddlFiltrarPerfil" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlFiltrarPerfil_SelectedIndexChanged" >
        <asp:ListItem  Text="Ninguno" Value="Ninguno"></asp:ListItem>
        <asp:ListItem  Text="Host" Value="Host"></asp:ListItem>
        <asp:ListItem  Text="Fotografo" Value="Fotografo"></asp:ListItem>
        <asp:ListItem  Text="UserEvent" Value="UserEvent"></asp:ListItem>
        <asp:ListItem  Text="User" Value="User"></asp:ListItem>
        </asp:DropDownList> </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName"
        DataSourceID="UserODS" AllowPaging="True" AllowSorting="True" 
        OnRowEditing="GridView1_RowEditing">
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="Usuario" ReadOnly="True" SortExpression="UserName" />
            <asp:BoundField DataField="Email" HeaderText="Correo" SortExpression="Email" ReadOnly="True" />
            <asp:BoundField DataField="PasswordQuestion" HeaderText="PasswordQuestion" ReadOnly="True"
                SortExpression="PasswordQuestion" Visible="False" />
            <asp:BoundField DataField="Comment" HeaderText="Comment" SortExpression="Comment"
                Visible="False" />
            <asp:CheckBoxField DataField="IsApproved" HeaderText="Estado" SortExpression="IsApproved"
                ReadOnly="True" />
            <asp:CheckBoxField DataField="IsLockedOut" HeaderText="Bloqueado" ReadOnly="True"
                SortExpression="IsLockedOut" />
            <asp:BoundField DataField="LastLockoutDate" HeaderText="LastLockoutDate" ReadOnly="True"
                SortExpression="LastLockoutDate" Visible="False" />
            <asp:BoundField DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True"
                SortExpression="CreationDate" Visible="False" />
            <asp:BoundField DataField="Rol" HeaderText="Perfil" ReadOnly="True" SortExpression="Rol" />
            <asp:BoundField DataField="LastLoginDate" HeaderText="UltimoLogin" SortExpression="LastLoginDate" ReadOnly="True" />
            <asp:BoundField DataField="LastActivityDate" HeaderText="LastActivityDate" SortExpression="LastActivityDate"
                Visible="False" />
            <asp:BoundField DataField="LastPasswordChangedDate" HeaderText="LastPasswordChangedDate"
                ReadOnly="True" SortExpression="LastPasswordChangedDate" Visible="False" />
            <asp:CheckBoxField DataField="IsOnline" HeaderText="EnLinea" ReadOnly="True" SortExpression="IsOnline" />
            <asp:BoundField DataField="ProviderName" HeaderText="ProviderName" ReadOnly="True"
                SortExpression="ProviderName" Visible="False" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Editar"></asp:LinkButton>&nbsp;
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                        OnClientClick="return confirm('Esta seguro de seguir adelante?');" Text="Borrar"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerSettings FirstPageText="Inicio" LastPageText="Fin" Mode="NumericFirstLast"
            NextPageText="Siguiente" Position="TopAndBottom" PreviousPageText="Anterior" />
        <PagerStyle HorizontalAlign="Center" />
    </asp:GridView>
    <asp:ObjectDataSource ID="UserODS" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetMembers" TypeName="ClickSocial.DataSourceControls.UserDataSource"
        UpdateMethod="Update" SortParameterName="SortData">
        <DeleteParameters>
            <asp:Parameter Name="original_UserName" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="original_UserName" Type="String" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="isApproved" Type="Boolean" />
            <asp:Parameter Name="IsLockedOut" Type="Boolean" />
        </UpdateParameters>
        <SelectParameters>
            <asp:Parameter Name="sortData" Type="String" DefaultValue="SortData" />
            <asp:ControlParameter ControlID="ddlFiltrarPerfil" DefaultValue="Ninguno" Name="filtroPorRol"
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="userName" Type="String" />
            <asp:Parameter Name="isApproved" Type="Boolean" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="passwordQuestion" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="passwordAnswer" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <br />
    <uc2:EditUser ID="EditUser1" runat="server" Visible="false" />
    <br />
    <uc1:NewUser ID="NewUser1" runat="server" Visible="false" />
    
</asp:Content>
